package com.zz.demo.controller;

import com.zz.demo.entity.Result;
import com.zz.demo.entity.po.User;
import com.zz.demo.service.FileUploadService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/file")
public class FIleUploadController {

    @Resource
    private FileUploadService fileUploadService;

    @PostMapping("/openLine")
    public Result<?> openLine(@RequestBody List<String> openIds) {
        return fileUploadService.startTransfer(openIds);
    }

    @PostMapping("/closeLine")
    public Result<?> closeLine(@RequestBody List<String> closeIds) {
        return fileUploadService.stopTransfer(closeIds);
    }

    @GetMapping("/test")
    public Result<List<User>> userResultTest() {
        List<User> userList = new ArrayList<>();
        User userHua = new User();
        User userXue = new User();

        userList.add(userHua);
        userList.add(userXue);
        return Result.ok(userList);
    }

}
